<?php

class Admin_Form_Login extends Zend_Form
{

    public function init()
    {
        $email = new Zend_Form_Element_Text('email');
        $email->setLabel('Email')->setRequired(true)
                ->addValidator('EmailAddress')
                ->setErrorMessages(array('format adresse email'))
                ->setAttribs(array('placeholder' => 'Email Address' ,'required' => true, ''));
        $email->setRequired(true);

        $password = new Zend_Form_Element_Password('password');
        $password->setLabel('Mot de passe')->setRequired(true)
                ->addValidator('StringLength', false, array(6, 20))
                ->setErrorMessages(array('min 6 caractères'))
                ->setAttribs(array('placeholder' => 'Password' ,'required' => true, ''));
        $password->setRequired(true);

        $submit = new Zend_Form_Element_Submit('submit');
        $submit ->setLabel('Valider')
                ->setAttrib('class', 'btn btn-large btn-primary');

        $this->addElements(array($email, $password, $submit));
//        $this->addDisplayGroup(array('email'=>$email, 'password'=>$password, 'submit'=>$submit ),
//                 'info', array());
    }

    public function  __construct($form_login = null) {
        parent::__construct($form_login);

        $this->setMethod('Post');
        $this->setName('formLogin');
//        $this->setAttrib('class', 'form-signin');

        

//        $decorators = array(
//	    array('ViewHelper'),
//	    array('Errors'),
//	    array('Description', array('tag' => 'p', 'class' => 'description')),
//	    array('HtmlTag', array('tag' => 'dd')),
//	    array('Label', array('tag' => 'dt', 'class' => 'pass_label')),
//	);
//
//        $password->setDecorators($decorators);

//        $this->setElementDecorators(array(
//                    'viewHelper',
//                    'Errors',
//                    array(array('data'=>'HtmlTag'),array('tag'=>'td')),
//                    array('Label',array('tag'=>'td')),
//                    array(array('row'=>'HtmlTag'),array('tag'=>'tr'))
//        ));
//
//        $this->setDecorators(array(
//                'FormElements',
//                array(array('data'=>'HtmlTag'),array('tag'=>'table')),
//                'Form'
//        ));
        
//        $this->addElements(array($login, $password, $submit));

//        $this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'Valider', 'class' => 'btn btn-large btn-primary'));

        
    }

}

